<template>
  <div>
    <table class="bs-table">
      <tr class="bs-table_row">
        <th class="bs-table_th" style="width: 200px">征求主题</th>
        <td class="bs-table_td" colspan="3">{{opinionDetailData.title}}</td>
      </tr>
      <tr class="bs-table_row">
        <th class="bs-table_th">发起部门</th>
        <td class="bs-table_td">{{opinionDetailData.deptName}}</td>
        <th class="bs-table_th">截止日期</th>
        <td class="bs-table_td">{{opinionDetailData.endDate}}</td>
      </tr>
      <tr class="bs-table_row">
        <th class="bs-table_th">征求说明</th>
        <td class="bs-table_td" colspan="3">{{opinionDetailData.content}}</td>
      </tr>
      <tr class="bs-table_row">
        <th class="bs-table_th">创建时间</th>
        <td class="bs-table_td">{{opinionDetailData.createTime}}</td>
        <th class="bs-table_th">创建人</th>
        <td class="bs-table_td">{{opinionDetailData.createNickname}}</td>
      </tr>
      <tr class="bs-table_row">
        <th class="bs-table_th">附件</th>
        <td class="bs-table_td" colspan="3">
          <div v-for="fileid in opinionDetailData.files" :key="fileid">
            <preview :attachementId="fileid" v-if="fileid"></preview>
          </div>
        </td>
      </tr>
    </table>
  </div>
</template>

<script>
  import {getOpinion} from "@/api/opinion";
  import {getFileTypeFiles} from '@/views/util'

  export default {
    name: "opinionDetail",
    created() {
      this.getDetailData_opinion();
    },
    props: {
      opinionId: null,
    },
    data() {
      return {
        opinionDetailData: {
          files: [],
        },
      }
    },
    methods: {
      getDetailData_opinion() {
        getOpinion(this.opinionId).then(async response => {
          var records = response.data.data;
          this.opinionDetailData.title = records.title;
          this.opinionDetailData.deptName = records.deptName;
          this.opinionDetailData.endDate = records.endDate;
          this.opinionDetailData.content = records.content;
          this.opinionDetailData.createTime = records.createTime;
          this.opinionDetailData.createNickname = records.createNickname;
          let files = records.fileIds;
          this.opinionDetailData.files = files;
        })
      },

    },
  }
</script>

<style scoped>

</style>
